package com.universalInterface.lims_interface.controller;


import cn.hutool.core.bean.BeanUtil;
import com.universalInterface.common.result.ApiResult;
import com.universalInterface.lims_interface.entity.TestReport;
import com.universalInterface.lims_interface.mapper.TestInfoMapper;
import com.universalInterface.lims_interface.mapper.TestReportMapper;
import com.universalInterface.lims_interface.service.ITestInfoService;
import com.universalInterface.lims_interface.service.ITestReportService;
import com.universalInterface.lims_interface.vo.api.param.TestReportParamVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * 实验室测试报告数据
 * </p>
 *
 * @author author
 * @since 2023-12-19
 */
@Tag(name = "实验室测试报告数据")
@Validated
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/testReport")
public class TestReportController {
    public final ITestReportService iTestReportService;
    @Operation(summary = "批量新增试验报告")
    @PostMapping("/addReport")
    public ApiResult add(@Parameter(description = "上传报告") @Valid @RequestBody List<TestReportParamVo>  paramVo){
        int i = iTestReportService.addBatch(BeanUtil.copyToList(paramVo, TestReport.class));
        return ApiResult.success("添加成功");
    }
}
